bits 32

;void jmp_to_new_stack(void *stack_buffer, size_t stack_size, void(*function_to_run)(void *userdata), void *userdata, jmp_buf returning, int longjmp_value);
jmp_to_new_stack:
	mov eax, esp
	mov esp, [eax + 4]
	add esp, [eax + 8]
	push dword [eax + 24]
	push dword [eax + 20]
	push dword [eax + 16]
	call dword [eax + 12]
	add esp, 4
	push dword 0xDEADBEEF
	jmp my_longjmp
	times 4 - ($ - $$ & 3) nop

%include "x86_my_longjmp.asm"
